<?php
/**
 * Created by : Sandi Rizky Kharisma (sandi.informatics08@gmail.com)
 * This Class Generated for CRUD purpose only
 */
class detail_order extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();

        $this->load->library('auth');
        $this->load->library('base');
        $this->load->library('ajaxresponse');
        $this->load->library('datatables');
        $this->load->model('crud/m_detail_order');
    }


    public function get_all($id = null)
    {
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $result = $this->m_detail_order->get("ID_ORDER = $id");
        if($result->num_rows() > 0)
            $this->response->data = $result->result();
        echo json_encode($this->response);
    }

    public function add()
    {
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_detail_order->insert();
        echo json_encode($this->response);
    }

    public function do_realisasi($id_order,$id_faktur){
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_detail_order->realisasi($id_order,$id_faktur);
        echo json_encode($this->response);
    }

    public function delete_detail($iddetailorder){
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_detail_order->deletedetail($iddetailorder);
        echo json_encode($this->response);
    }

   
}
?>